package com.naiterui.ehp.bp.domain;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;

import org.apache.commons.lang3.StringUtils;

import lombok.Data;

/**
 * 患者备注病情表
 *
 * @version 2017年6月11日 by wangchuan
 * @Description
 */
@Entity
@Data
@Table(name = "dr_patient_disease")
public class PatientDisease {
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    private Long id;

    /**
     * 医生id
     */
    @Column(name = "doctor_id")
    private Long doctorId;

    /**
     * 患者id
     */
    @Column(name = "patient_id")
    private Long patientId;

    /**
     * 患者婚姻状态(0:未婚，1:已婚)
     */
    @Column(name = "marital_status", columnDefinition = "bit", length = 1)
    private Integer maritalStatus;

    /**
     * 身高
     */
    @Column(name = "height")
    private Integer height;

    /**
     * 体重
     */
    @Column(name = "weight")
    private Integer weight;

    /**
     * 过敏药物历史
     */
    @Column(name = "medication_allergy")
    private String medicationAllergy;

    /**
     * 既往病史
     */
    @Column(name = "past_disease")
    private String pastDisease;

    /**
     * 家庭病史
     */
    @Column(name = "family_history")
    private String familyHistory;

    /**
     * 遗传病史
     */
    @Column(name = "hereditary_disease")
    private String hereditaryDisease;

    /**
     * 吸烟情况
     */
    @Column(name = "smoke_history")
    private String smokeHistory;

    /**
     * 饮酒情况
     */
    @Column(name = "drink_history")
    private String drinkHistory;

    /**
     * 医生是否已采用患者填写病情：0.未采用 1.已采用
     */
    @Column(name = "used", columnDefinition = "bit", length = 1)
    private Integer used;

    /**
     * 创建时间
     */
    @Column(name = "created_at")
    private Date createdAt;

    /**
     * 修改时间
     */
    @Column(name = "changed_at")
    private Date changedAt;

    /**
     * 创建人
     */
    @Column(name = "created_by")
    private String createdBy;

    /**
     * 修改人
     */
    @Column(name = "changed_by")
    private String changedBy;

    @Version
    private Integer version;

    /**
     * 医生是否已采用患者填写病情：0.未采用
     */
    public static final Integer USED_FALSE = 0;
    /**
     * 医生是否已采用患者填写病情：1.已采用
     */
    public static final Integer USED_TRUE = 1;

    public boolean remarkEmpty() {
        return this.maritalStatus == null && this.height == null && this.weight == null && StringUtils.isBlank(this.medicationAllergy)
                && StringUtils.isBlank(this.pastDisease) && StringUtils.isBlank(this.familyHistory) && StringUtils.isBlank(this.hereditaryDisease)
                && StringUtils.isBlank(this.smokeHistory) && StringUtils.isBlank(this.drinkHistory);
    }


}
